import React from 'react';
import { Row, Col } from 'antd';
import _ from 'lodash';
import { useTranslation } from 'react-i18next';
import AdvancedWrap from '@/components/AdvancedWrap';

interface Props {
  data: any;
}
export default function Index(props: Props) {
  const { t } = useTranslation('datasourceManage');
  const { data } = props;

  return (
    <div data-oid='jeyq27n'>
      <div className='page-title' data-oid='2gi06aa'>
        HTTP
      </div>
      <div className='flash-cat-block' data-oid='66985ph'>
        <Row gutter={16} data-oid='-20r-0_'>
          <Col span={24} data-oid='gkincb-'>
            URL：
          </Col>
          <Col span={24} className='second-color' data-oid='k:56ppm'>
            {data?.http?.url}
          </Col>
        </Row>
      </div>
      <div className='page-title' data-oid='opacl2-'>
        {t('form.auth')}
      </div>
      <div className='flash-cat-block' data-oid='xikcvvn'>
        <Row gutter={16} data-oid='zj5tgww'>
          <Col span={8} data-oid='76z4bot'>
            {t('form.username')}：
          </Col>
          <Col span={8} data-oid='c1s06vv'>
            {t('form.password')}：
          </Col>
          <Col span={8} data-oid='ch-3shz'>
            {t('form.skip_ssl_verify')}：
          </Col>
          <Col span={8} className='second-color' data-oid='difvxw2'>
            {data?.auth?.basic_auth_user || '-'}
          </Col>
          <Col span={8} className='second-color' data-oid='pqivh4n'>
            {data?.auth?.basic_auth_password ? '******' : '-'}
          </Col>
          <Col span={8} className='second-color' data-oid='3lftn63'>
            {data.http?.tls?.skip_tls_verify ? t('form.yes') : t('form.no')}
          </Col>
        </Row>
      </div>
      {!_.isEmpty(data?.http?.headers) && (
        <>
          <div className='page-title' data-oid='..4gk7u'>
            {t('form.headers')}
          </div>
          <div className='flash-cat-block' data-oid='l03nn0c'>
            <Row gutter={16} data-oid='57tuy5a'>
              {_.map(data?.http?.headers, (val, key) => {
                return (
                  <Col key={key} span={24} data-oid='jy4yzeu'>
                    {key + ' : ' + val}
                  </Col>
                );
              })}
            </Row>
          </div>
        </>
      )}
    </div>
  );
}
